************************************************
***Title: robustness_pollution.do
***Creators: Joelle Abramowitz, Shooshan Danagoulian, and Owen Fleming*
***Notes: This file produces the estimates of the effect of pollen exposure on suicide using aqi as a control/interaction and pm2.5 as a control/interaction. 

*For questions, contact
*Owen Fleming
*hg3490@wayne.edu
************************************************


**********SETUP
use data/for_analysis, clear


**********PRODUCE ESTIMATES
***AQI
*Generate sample
ppmlhdfe count pollen_q2_ls c.pollen_q2_ls#c.aqi_q4_ls pollen_q3_ls pollen_q3_ls#c.aqi_q4_ls pollen_q4_ls pollen_q4_ls#c.aqi_q4_ls aqi_q4_ls $weather, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
gen sample = e(sample)

*Treatment: location-season quartiles
eststo main_s3: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Year x Month, Month x Day"

*Treatment: location-season quartiles
eststo main_s3_aqi_cont: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls aqi_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather, AQI Q4 indicator" 
estadd local FE "County, Year x Month, Month x Day"

*Treatment: location-season quartiles
eststo main_s3_aqi_int: ppmlhdfe count pollen_q2_ls c.pollen_q2_ls#c.aqi_q4_ls pollen_q3_ls c.pollen_q3_ls#c.aqi_q4_ls pollen_q4_ls c.pollen_q4_ls#c.aqi_q4_ls aqi_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather, AQI Q4 indicator" 
estadd local FE "County, Year x Month, Month x Day"

drop sample


***PM2.5
*Generate sample
ppmlhdfe count pollen_q2_ls c.pollen_q2_ls#c.pm2pt5_q4_ls pollen_q3_ls pollen_q3_ls#c.pm2pt5_q4_ls pollen_q4_ls pollen_q4_ls#c.pm2pt5_q4_ls pm2pt5_q4_ls $weather, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
gen sample = e(sample)

*Treatment: location-season quartiles
eststo main_s3: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Year x Month, Month x Day"

*Treatment: location-season quartiles
eststo main_s3_pm2pt5_cont: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls pm2pt5_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather, PM2.5 Q4 indicator" 
estadd local FE "County, Year x Month, Month x Day"

*Treatment: location-season quartiles
eststo main_s3_pm2pt5_int: ppmlhdfe count pollen_q2_ls c.pollen_q2_ls#c.pm2pt5_q4_ls pollen_q3_ls c.pollen_q3_ls#c.pm2pt5_q4_ls pollen_q4_ls c.pollen_q4_ls#c.pm2pt5_q4_ls pm2pt5_q4_ls $weather if sample==1, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather, PM2.5 Q4 indicator" 
estadd local FE "County, Year x Month, Month x Day"

drop sample


**********EXPORT RESULTS
estout using results/robustness_pollution.xls, cells(b(star label(Coef.) fmt(4)) se(par(`"="("'`")""') label(Std. Err.) fmt(4))) stats(ymean N counties Controls FE) starlevels(* 0.1 ** 0.05 *** 0.01) keep(pollen_q2_ls c.pollen_q2_ls#c.aqi_q4_ls c.pollen_q2_ls#c.pm2pt5_q4_ls pollen_q3_ls c.pollen_q3_ls#c.aqi_q4_ls c.pollen_q3_ls#c.pm2pt5_q4_ls pollen_q4_ls c.pollen_q4_ls#c.aqi_q4_ls c.pollen_q4_ls#c.pm2pt5_q4_ls aqi_q4_ls pm2pt5_q4_ls) order(pollen_q2_ls c.pollen_q2_ls#c.aqi_q4_ls c.pollen_q2_ls#c.pm2pt5_q4_ls pollen_q3_ls c.pollen_q3_ls#c.aqi_q4_ls c.pollen_q3_ls#c.pm2pt5_q4_ls pollen_q4_ls c.pollen_q4_ls#c.aqi_q4_ls c.pollen_q4_ls#c.pm2pt5_q4_ls aqi_q4_ls pm2pt5_q4_ls) legend label replace 
eststo clear


